<template>
  <data-set :dataSource="dataSource"  >
    <template slot="body">
      <div v-loading="dataSource.status()==='loading'">
        <div v-for="item in dataSource.datas()" >
          <slot name="block" :item="item" style="width: 100%"></slot>
        </div>
      </div>
    </template>
    <slot slot="footer" >
      <el-pagination style="text-align: center" @current-change="currentChange" background
                     layout="prev, pager, next"
                     :total=dataSource.total()>
      </el-pagination>
    </slot>
  </data-set>
</template>

<script>
  import DataSource from '@/framework/components/dataset/DataSource';
  import DataSet from '@/framework/components/DataSet';

  export default {
    name: "DataList",
    components: {
      DataSet
    },
    data() {
      return {
        dataSource: new DataSource(),
      }
    },
    props: ['dataSourceConfig'],
    methods: {
      currentChange(page) {
        this.dataSource.search();
      }
    },
    created(){
      this.dataSource.search();
    },
    mounted() {
    }
  }
</script>

<style scoped>

</style>
